package com.cy.zs.hp.controller;


import com.cy.zs.hp.common.exception.HpException;
import com.cy.zs.hp.common.jsonResult.JsonResult;
import com.cy.zs.hp.model.HisPatient;
import com.cy.zs.hp.service.IHisPatientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 该表为患者表，当患者预约挂号时使用此表 前端控制器
 * </p>
 *
 * @author cgb2008
 * @since 2020-11-28
 */
@RestController
@RequestMapping("/hp/hisPatient")
public class HisPatientController {
    @Autowired
    private IHisPatientService iHisPatientService;
    /*插入患者*/
    @RequestMapping("/doAddPatient")
    public JsonResult doAddPatient(@RequestBody HisPatient hisPatient){
        int i = iHisPatientService.insertPatient(hisPatient);
        String phone = hisPatient.getPhone();
        List<HisPatient> patientsLlist = iHisPatientService.findPatient(phone);
        return new JsonResult(patientsLlist);
    }
}
